package com.bharatonjava.swift.web;

import java.util.List;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

import com.bharatonjava.swift.domain.Employee;
import com.bharatonjava.swift.domain.Enumeration;
import com.bharatonjava.swift.service.EmployeeService;
import com.bharatonjava.swift.service.EnumerationService;

public class EmployeeBean {

	private Employee employee;

	private EmployeeService employeeService;
	private EnumerationService enumerationsService;
	private List<Enumeration> designations;
	
	public EmployeeService getEmployeeService() {
		return employeeService;
	}

	public void setEmployeeService(EmployeeService employeeService) {
		this.employeeService = employeeService;
	}

	public EnumerationService getEnumerationsService() {
		return enumerationsService;
	}
	
	public void setEnumerationsService(EnumerationService enumerationsService) {
		this.enumerationsService = enumerationsService;
	}
	
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}
	
	public List<Enumeration> getDesignations() {
		return designations;
	}
	
	public void setDesignations(List<Enumeration> designations) {
		this.designations = designations;
	}

	@PostConstruct
	private void intializeBean() {
		employee = new Employee();
		this.designations = enumerationsService.getEnumerationsByGroup("DESIGNATION");
	}

	@PreDestroy
	private void destroyBean() {

	}

	public void saveEmployee() {
		System.out.println("saveEmployee");
		System.out.println(this.employee);
		
	}
	
	public void resetEmployeeForm(){
		this.employee = new Employee();
	}

}
